<template>
	<view>
		<!-- 消息详情 -->
		<view class="messageDetail" @click="clickDetail">
			<view>
				<h3>{{messageDetail.noticeTitle}}</h3>
				<!-- <text>项目详情&nbsp;></text> -->
			</view>
			<!-- 内容 -->
			<view>
				<text>{{messageDetail.noticeContent||'暂无数据...'}}</text>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				messageDetail: {},
				noticeTitle: '', //标题
				noticeContent: '', //内容
			};
		},
		onLoad: function(options) {
			// 需要转换 JSON：通常用于与服务端交换数据。在向服务器发送数据时一般是字符串。
			this.messageDetail = JSON.parse(options.item) //接收传过来的item
			// console.log('接收消息列表的item', this.messageDetail);
		},

		methods: {
			// 进入项目详情
			clickDetail() {
				let prjId = this.messageDetail.prjId; //项目详情ID
				// console.log('---------------', prjId);
				let noticeCategory = this.messageDetail.noticeCategory; //项目
				// 项目:44	方案确认:36	签收提醒:30  当prjId==0时 项目实际被去除了
				if (prjId == 0) {
					uni.showToast({
						title: '此消息的项目已被删除',
						icon: 'none',
					});
					return
				}
				if (noticeCategory == '44' || noticeCategory == '36' || noticeCategory == '30') {
					uni.navigateTo({
						url: './../../project/project_detail/project_detail?id=' + prjId
					})
				}


			}
		},
	}
</script>

<style lang="less" scoped>
	.messageDetail {
		width: 90%;
		background-color: #FFFFFF;
		margin: auto;
		border-radius: 10rpx;
		margin-top: 40rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-around;

		>view:nth-child(1) {
			margin-top: 10rpx;

			>h3 {
				margin-left: 20rpx;
			}
		}

		>view:nth-child(2) {
			width: 80%;
			margin: auto;
			font-size: 22rpx;
			padding: 10rpx 0 20rpx 0;
		}
	}
</style>
